package com.luguangtao.controller;

import com.luguangtao.api.RibbonApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RibbonController2 {
    @Autowired
    RibbonApi ribbonApi;

    //测试客户端
    @RequestMapping("lists")
    public String lists() {

        int server111 = 0;
        int server222 = 0;
        int server333 = 0;

        for (int i = 0; i < 10000; i++) {
            String s = ribbonApi.test001();
            if (s.equals("1")) {
                server111++;
            } else if (s.equals("2")) {
                server222++;
            } else if (s.equals("3")) {
                server333++;
            }
        }
        System.out.println("server111===============调用了" + server111 + "次");
        System.out.println("server222===============调用了" + server222 + "次");
        System.out.println("server333===============调用了" + server333 + "次");
        return "server01被调用了:" + server111 + "次" + "server02被调用了:" + server222 + "次" + "server03被调用了:" + server333 + "次";
    }
}
